;(function(){
    angular.module('app')
        .controller('userSlideViewController', userSlideViewController);

    userSlideViewController.$inject = [ '$scope', 'userInfoService'];
    function userSlideViewController( $scope, userInfoService ){
        ons.ready(function () {

            $scope.index_tabbar.on( "prechange", function (event) {
                console.log(userInfoService.checkLogined());
                if( !userInfoService.checkLogined() ){
                    event.cancel();
                    $scope.ons.navigator.pushPage("pages/login/login.html");
                }
            });

            $scope.index_tabbar.on( "postchange", function (event) {

                if($scope.index_tabbar.getActiveTabIndex() == 1){
                    menu.setSwipeable(true);
                }else{
                    menu.setSwipeable(false);
                }
            });


        });

    }

})();
